package styledaco.schedule;

import java.io.IOException;
import java.text.ParseException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

public class SchedulerManager extends HttpServlet{
	private SchedulerFactory schedFact;
	private Scheduler sched;
	static Logger log = Logger.getLogger(SchedulerManager.class);
	public SchedulerManager() {
		try {
			schedFact = new StdSchedulerFactory();
			sched = schedFact.getScheduler();
			sched.start();
			
			JobDetail jobSetTags = new JobDetail("Job_SetTags", "group", JobSetTags.class);
			//자정에 수행
			CronTrigger trigger = new CronTrigger("Trigger_SetTags","group","0 0 0 * * ?");

			//scheduler에다가 추가한다 잡을-
			//sched.scheduleJob(jobSetTags,trigger);
			
		} catch (SchedulerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		log.debug("SchedulerManager COMPLETE!!!!!!!!!");
		
	}	
}
